package com.dong.policy.config;

import com.aliyun.openservices.ons.api.bean.ProducerBean;
import com.dong.common.mq.MqService;
import com.dong.policy.mq.PolicyMqConfig;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.annotation.Resource;

/**
 * @author zhaodongchao
 * @date 2020/11/19 16:56
 */
@Configuration
public class MQConfig {
    @Resource
    private MqService mqService ;

    @Bean(name = "policyProducer",initMethod = "start" ,destroyMethod = "shutdown")
    public ProducerBean policyProducerBean(PolicyMqConfig config){
        return mqService.createProducer(config);
    }

}
